<template>
  <el-card>
    <div class="row">
      <div class="row-title">{{ title }}</div>
      <div v-if="sub_title.length > 0">
        <div class="row" v-for="item in sub_title" :key="item">
          <div class="row-sub-title">{{ item }}</div>
          <div><slot :name="item"></slot></div>
        </div>
      </div>
      <div v-else>
        <slot></slot>
      </div>
    </div>
  </el-card>
</template>

<script>
export default {
  props: {
    title: {
      type: String
    },
    sub_title: {
      type: Array,
      default: () => {
        return []
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.row {
  display: flex;
  padding: 10px 20px;
  align-items: center;
  .row-title {
    width: 120px;
    font-size: 14px;
  }
  .row-sub-title {
    width: 100px;
    margin-right: 10px;
    text-align: center;
    line-height: 32px;
    background: #fafafa;
  }
}
</style>